// 模拟用户数据
const mockUserData = {
  token: 'mock-token-123456',
  userInfo: {
    id: 1,
    nickName: '测试用户',
    avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=1',
    userType: 'distributor', // 'user' 或 'distributor'
    distributorStats: {
      teamCount: 156,
      totalEarnings: 15680
    }
  }
}

export const mockApi = {
  login: (username, password) => {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        if (username === 'admin' && password === '123456') {
          resolve({
            code: 200,
            data: mockUserData,
            message: '登录成功'
          })
        } else {
          reject({
            code: 401,
            message: '用户名或密码错误'
          })
        }
      }, 1000)
    })
  },
  
  getUserInfo: () => {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve({
          code: 200,
          data: mockUserData.userInfo,
          message: '获取成功'
        })
      }, 500)
    })
  }
} 